package guice.command.model;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class TheatreDB {

	private static List<Play> PlaySource = new ArrayList<Play>();

	private static Map<String, Play> plays = new HashMap<String, Play>();

	static {
		PlaySource.add(new Play("Much Ado about Nothing", "William Shakespeare", 1590));
		PlaySource.add(new Play("Meghdoot", "Kalidas", 400));
		PlaySource.add(new Play("Hanush", "Bhishm Sahni", 1977));

		// now register into the map
		for (Play m : PlaySource) {
			plays.put(m.getTitle(), m);
		}
	}

	public static Play getPlay(String title) {
		if (plays.containsKey(title))
			return plays.get(title);
		return null;
	}

}
